package model;

import java.util.ArrayList;
import pakhib.*;
import java.util.Iterator;
import java.util.List;


import pakhib.ServiceEmploye;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

import pakhib.HibernateUtil;
import net.sf.hibernate.*;
public class RemlirSelects {
	
	private ArrayList<String> nomList;	
	
	
	
public ArrayList<String> getNomList() {
		return nomList;
	}
public void setNomList(ArrayList<String> nomList) {
		this.nomList = nomList;
	}



public ArrayList<String> rempirAutocompiliter()
{
	//Employe employ=new Employe(); 
	Utilisateur empl =new Utilisateur(2);
	nomList = new ArrayList<String>();
	Session session=HibernateUtil.getSessionFactory().openSession();
	 Transaction Tx=session.beginTransaction();
	
	 String SQL_QUERY ="from Employe";
	 Query query = session.createQuery(SQL_QUERY);
	 List resultat=query.list();
	 for(Iterator it=resultat.iterator();it.hasNext();)
	 {
		 
		// Object[] firstResult = (Object[])resultat.get(0); 
		 Object[] row = (Object[]) it.next();
		 String firstResult=(String)row[1];
		 nomList.add(firstResult);
		 
	 }
	 //nomList.add("salam");
    return nomList;
}

}
